<div id="wrapper">

	<div id="toolbox" class="clearfix">
		
	
<?php 
			if ( isset($_SESSION['auth']) )
				{
			?>
<div id="toolbox-bio">
			
			<div id="avatar">
				
					<?php 
					include 'connect.php';
					$sql = "SELECT email FROM $table_name 
					  WHERE user_name='$_SESSION[logname]'";
					$result = mysql_query($sql,$db);
					$infos = mysql_fetch_array($result);
					$email = $infos[0];


					$default = "http://".$_GLOBALS['site_url']."img/avatar-opencv.png";
					$size = 40;

					$grav_url = "http://www.gravatar.com/avatar.php?
					gravatar_id=".md5($email).
					"&default=".urlencode($default).
					"&size=".$size; 

					?>
				<img src="<?php echo $grav_url; ?>" alt="Avatar" />
				<strong>Avatar</strong> (<a href="#asdf">Change</a>)
			</div>
			<script type="text/javascript">
			    //<![CDATA[
			    $(document).ready(function() {
					 $(".wiadn").editable("<?php echo $_GLOBALS['site_url']; ?>php/save_wiadn.php", { 
						 type      : 'textarea',
						 cancel    : 'Annuler',
						 submit    : 'OK',
						 indicator : "<img src='<?php echo $_GLOBALS['site_url']; ?>img/indicator.gif'>",
						 tooltip   : 'Cliquer pour &eacute;diter...'
					 });
				 });

			    //]]>
			</script>
			<div id="bio">
				<h3><?php echo $_SESSION['logname']; ?></h3>
				<h4>Ce que je fais en ce moment:</h4>
				<p class="wiadn" title="Click to edit...">
					<?php 
					$action = getLastAction($_SESSION['logname']);
					echo $action['action_text'];
					?>
				</p>
				<a href="<?php echo $_GLOBALS['site_url'].'profil.php'; ?>" id="bio-profile">Voir mon profil</a>
			</div>
			
		</div>

		<div id="toolbox-blog">

				<h3>Votre Blog </h3>
				<ul>
				<?php

					include 'connect.php';
					$sql = "SELECT url_rss FROM $table_name 
					  WHERE user_name='$_SESSION[logname]'";
					$result = mysql_query($sql,$db);
					$theurl = mysql_fetch_array($result);
					$thefeed = $theurl[0];
					$feed = new SimplePie($thefeed);
					$feed->handle_content_type();
					$n = 0;
					foreach ($feed->get_items() as $item)
					{
						$feed = $item->get_feed();
						echo "<li><img alt='".$feed->get_title()."' src='".$feed->get_favicon()."' /><a href='".$item->get_permalink()."' title='".$feed->get_title()."'>".$item->get_title()."</a> | post&eacute; le ".$item->get_date()."</li>";
						$n ++;
						if($n == 3)
						{break;}

					}
				?>
				</ul>
				
			<a href="<?php echo $feed->get_permalink(); ?>" target="_blank">More</a>
		</div>
		<div id="toolbox-friends">
			<h3>Votre CV</h3>
			<ul>
				<li><img src="<?php echo $_GLOBALS['site_url']; ?>img/format/page_html.gif" alt="HTML" /> <a href="<?php echo $_GLOBALS['site_url']; ?>cv-html/<?php echo $_SESSION[logname]; ?>" target="_blank">Au format HTML</a></li>
				<li><img src="<?php echo $_GLOBALS['site_url']; ?>img/format/file_font.gif" alt="TXT" /> <a href="#asdf">Au format TXT</a></li>
				<li><img src="<?php echo $_GLOBALS['site_url']; ?>img/format/file_acrobat.gif" alt="PDF" /> <a href="<?php echo $_GLOBALS['site_url']; ?>cv-pdf/<?php echo $_SESSION[logname]; ?>" target="_blank">Au format PDF</a></li>
				<li><img src="<?php echo $_GLOBALS['site_url']; ?>img/format/page_html.gif" alt="Avatar" /> <a href="#asdf">Au format HTML</a></li>
			</ul>

		</div>
		<div id="toolbox-recent">
			
			<h3>Votre profil</h3>
			<ul>
				<?php
				
					$sql = "SELECT last_update FROM $table_name 
					  WHERE user_name='$_SESSION[logname]'";
					$result = mysql_query($sql,$db);
					$lastup = mysql_fetch_array($result);
					$lastupdate = $lastup[0];
				
				?>
				<li><img src="<?php echo $_GLOBALS['site_url']; ?>img/icon_home.gif" alt="Avatar" /> <a href="<?php echo $_GLOBALS['site_url'].'profil.php'; ?>">Consulter mon profil</a></li>
				<li><img src="<?php echo $_GLOBALS['site_url']; ?>img/page_edit.gif" alt="Avatar" /> <a href="<?php echo $_GLOBALS['site_url'].'modifier.php'; ?>">Modifier mon profil</a> derni&egrave;re modification le <?php echo $lastupdate;  ?></li>
				<li><img src="<?php echo $_GLOBALS['site_url']; ?>img/icon-blog.png" alt="Avatar" /> <a href="<?php echo $_GLOBALS['site_url'].'excv.php'; ?>">Modifier mon CV</a></li>
			</ul>
			
			
		</div>
<?php }
else {
?>
	<div id="toolbox-bio">
			
			<div id="avatar">
				
				<img src="<?php echo $_GLOBALS['site_url']; ?>img/avatar-opencv.png" alt="Avatar" />
				<strong>Avatar</strong>
			</div>
			<div id="bio">
				<h3>Open-CV</h3>
				<h4>Pourquoi utiliser Open-CV?</h4>
				<p class="editable" title="Click to edit...">
					<span id="noteFull1" >Simple, accessible et opensource. Le projet Open-CV est en constante &eacute;volution. Nous essayons d'ajouter des fonctions les pratiques possibles. Et si quelque chose ne vous plait pas, modifiez le, c'est opensource!</span>
				</p>
				
			</div>

		</div>

		<div id="toolbox-blog">

				<h3>Les derniers articles du blog</h3>
				<ul>
				<?php $feed = new SimplePie('http://feeds.feedburner.com/Opencv');
					$feed->handle_content_type();
					$n = 0;
					foreach ($feed->get_items() as $item)
					{
						$feed = $item->get_feed();
						echo "<li><img alt='".$feed->get_title()."' src='".$feed->get_favicon()."' /><a href='".$item->get_permalink()."' title='".$feed->get_title()."'>".$item->get_title()."</a> | post&eacute; le ".$item->get_date()."</li>";
						$n ++;
						if($n == 3)
						{break;}

					}?>
				</ul>

			<a href="" target="_blank">More</a>
		</div>
		<div id="toolbox-friends">
			<h3>Some links</h3>
			<ul>
				<li><img src="<?php echo $_GLOBALS['site_url']; ?>img/avatar-mullet.gif" alt="Avatar" /> <a href="http://opencv.kune.fr">OpenCV Blog</a></li>
				<li><img src="<?php echo $_GLOBALS['site_url']; ?>img/icon-tag-yellow.png" alt="OpenCV Manager" /> <a href="http://opencvmanager.kune.fr">OpenCV Homepage</a></li>
				<li><img src="<?php echo $_GLOBALS['site_url']; ?>img/report.png" alt="Jobberbase" /> <a href="http://jobberbase.com">Jobberbase App</a></li>
			</ul>

		</div>
		<div id="toolbox-recent">

			<h3>G&eacute;rez votre CV!</h3>
			<ul>
				<li><img src="<?php echo $_GLOBALS['site_url']; ?>img/icon_home.gif" alt="Avatar" /> <a href="#asdf">Consulter votre profil simplement...</a></li>
				<li><img src="<?php echo $_GLOBALS['site_url']; ?>img/page_edit.gif" alt="Avatar" /> <a href="#asdf">... Ou modifiez le!</a></li>
				<li><img src="<?php echo $_GLOBALS['site_url']; ?>img/icon-blog.png" alt="Avatar" /> <a href="#asdf">Et t&eacute;l&eacute;chargez votre CV</a></li>
			</ul>
		</div>


<?php } ?>

</div> <!-- end #toolbox -->

	<div id="navbar" class="clearfix">
		<ul class="clearfix">
			<li id="nav-dashboard"><a href="<?php echo $_GLOBALS['site_url']; ?>">Accueil</a></li>
			<?php if(isset($_GLOBALS['forum_url'])){ ?><li id="nav-forum"><a href="<?php echo $_GLOBALS['forum_url']; ?>" target="_blank">Forum</a></li><?php }?>
			<?php if(isset($_GLOBALS['blogurl'])){ ?><li id="nav-blog"><a href="<?php echo $_GLOBALS['blogurl']; ?>" target="_blank">Le Blog</a></li><?php }?>
			<?php if(isset($_GLOBALS['jbsitename'])){ ?><li id="nav-wiki"><a href="<?php echo $_GLOBALS['jbsiteurl']; ?>"><?php echo $_GLOBALS['jbsitename']; ?></a></li><?php }?>
			<li id="nav-member"><a href="#asdf">Membres</a></li>
			<li id="toolbox-tab"><a href="#asdf">Votre Toolbox <img src="<?php echo $_GLOBALS['site_url']; ?>img/arrow-down.gif" width="7" height="6" alt="" id="theArrow" /></a></li>
		</ul>
		<form id="search" action="">
			<input name="search" id="search-query" type="text" title="Search" />
			<input name="submit" type="image" src="<?php echo $_GLOBALS['site_url']; ?>img/search.png" />
		</form>	
	</div>

</div> <!-- end #wrapper -->